import {view, ViewGroup} from "adajs";
import NewsService from "./state.js";
import Bar from "../../../controls/bar";
import {getQueryInfo} from "./../../../lib/helper";
import List from "./../../../controls/lists";

@view({
    className: "news",
    template: "./template.html",
    style: "./style.scss",
    dataset: {
        service: NewsService
    }
})
class News extends ViewGroup {
    tags() {
        return {
            bar: Bar,
            list: List
        }
    }

    onready() {
        let r = getQueryInfo();
        if (r.id) {
            this.commit("load", r.id);
        }
    }
}

export default News;